#include<bits/stdc++.h>
using namespace std;
long long n,m=1;
bool flag=false;
int a[15]={0,2,3,5,7,11,13,17,19,23,29,31,37};
int main()
{
	cin>>n;
	while(m<n)
	{
		for(int i=1; i<=12; ++i)
		{
			if(i==1&&m*a[i]>n) flag=true;
			if(m*a[i]>n) break;
			m*=a[i];
		}
		if(flag) break;
	}
	cout<<m<<endl;
	return 0;
}
